package com.totcy.atom.net.exception;

public class ApiException extends RuntimeException {
    public static final int Code_TimeOut = Short.MAX_VALUE - 100;
    public static final int Code_UnConnected = Code_TimeOut - 1;
    public static final int Code_MalformedJson = Code_UnConnected - 1;
    public static final int Code_CacheError = Code_MalformedJson - 1;
    public static final int Code_ServiceFail = Code_CacheError - 1;
    public static final int Code_Other = Code_CacheError - 1;

    public static final String CONNECT_EXCEPTION = "网络连接异常，请检查您的网络状态";
    public static final String SOCKET_TIMEOUT_EXCEPTION = "网络连接超时，稍后重试";
    public static final String SERVER_EXCEPTION = "服务器异常";
    public static final String MALFORMED_JSON_EXCEPTION = "数据解析错误";

    public static final String RXCACHE_ORROR = "缓存数据异常";
    public static final String UNKNOWN_ERROR = "未知错误";

    /**服务器返回的错误码*/
    private int resultCode;

    public ApiException(int resultCode, String msg) {
        this(msg);
        this.resultCode = resultCode;
    }

    private ApiException(String detailMessage) {
        super(detailMessage);
    }

    public int getResultCode() {
        return resultCode;
    }
}

